package com.jxw.fragment;

import android.database.Cursor;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ListAdapter;
import android.widget.ListView;
import com.jxw.adapter.ZuiJinAdapter;
import com.jxw.constant.Constant;
import com.jxw.domain.DataEntity;
import com.jxw.domain.StudyRecord;
import com.jxw.launcher.R;
import java.util.ArrayList;
import java.util.List;

/* loaded from: classes.dex */
public class ZuiJinFragment extends Fragment {
    private ZuiJinAdapter adapter;
    private List<DataEntity> dataList = new ArrayList();
    private List<StudyRecord> datas = new ArrayList();
    private ListView listView_zuijin;

    @Override // android.support.v4.app.Fragment
    public View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
        View inflate = layoutInflater.inflate(R.layout.zuijinfragment, viewGroup, false);
        initGetdata();
        this.listView_zuijin = (ListView) inflate.findViewById(R.id.listView);
        listAdapter();
        return inflate;
    }

    private void initGetdata() {
        Cursor query = getActivity().getContentResolver().query(Constant.STUDY_RECORDR_URI, null, null, null, " _id DESC");
        if (query == null || query.getCount() <= 0) {
            return;
        }
        while (query.moveToNext()) {
            new StudyRecord();
            this.datas.add(new StudyRecord(query.getString(query.getColumnIndex("modul_name")), query.getString(query.getColumnIndex("modul_enter_time")), query.getString(query.getColumnIndex("modul_exit_time")), query.getString(query.getColumnIndex("modul_activity_duration")), query.getInt(query.getColumnIndex("modul_type"))));
        }
        query.close();
    }

    private void getData() {
        Cursor query = getActivity().getContentResolver().query(Constant.STUDY_RECENTLY_URI, null, null, null, "date desc");
        if (query == null || query.getCount() <= 0) {
            return;
        }
        while (query.moveToNext()) {
            this.dataList.add(new DataEntity(query.getInt(query.getColumnIndex("_id")), query.getString(query.getColumnIndex(Constant.MODULE)), query.getString(query.getColumnIndex(Constant.DATE)), query.getInt(query.getColumnIndex(Constant.TIME))));
        }
        query.close();
    }

    private void listAdapter() {
        this.adapter = new ZuiJinAdapter(getActivity(), this.datas);
        this.listView_zuijin.setAdapter((ListAdapter) this.adapter);
    }
}
